<?php
	include "comment.php";
	if(isset($_SESSION['name']) && isset($_SESSION['id'])){
	}else{
	    header("Refresh:0;url=login.html");
	}
	//判断是否有值传输过来
	if(isset($_POST)){
		//进入登陆页面，判断输入的账户密码是否正确
		$name = $_POST['name']; $pass = md5($_POST['pass']);
		$sql = "select * from user where name='$name' and pass='$pass' ";
		$query = db($sql);
		$ass=array();
		$row = mysqli_fetch_assoc($query);
		if($row){
			//存储登陆账户的用户名及账户id
			session_start();
			$_SESSION['name']=$row['name'];
			$_SESSION['id']=$row['id'];
			header("Refresh:0;url=demo.php");
		}else{
			header("Refresh:0;url=login.html");
		}
		
	}
	
?>